home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / gemfsc19 / gemfsc19.lzh / GNUGEM27 / AESMENU.C < prev    next >
C/C++ Source or Header  |  1993-03-24  |  5KB  |  209 lines

  1. /*
  2.  *    Aes menu library interface
  3.  *
  4.  *        menu_bar        Show/Hide menu bar
  5.  *        menu_icheck     Check/Uncheck a menu item
  6.  *        menu_ienable    Enable/Disable a menu item
  7.  *        menu_tnormal    Display a menu item in normal/rev video
  8.  *        menu_text        Change the text of a menu item
  9.  *        menu_register    Put desk accessory menu item in Desk menu
  10.  *            menu_popup            Display a popup menu
  11.  *            menu_attach         Attach, change, remove or inq about a submenu
  12.  *            menu_istart         Set / inq about starting menu item of a submenu
  13.  *            menu_settings        Set / inq submenu delay/scroll values
  14.  *
  15.  *        ++jrb    bammi@cadence.com
  16.  *        modified: mj -- ntomczak@vm.ucs.ualberta.ca
  17.  */
  18. #include "common.h"
  19.  
  20. #ifdef __DEF_ALL__
  21.  
  22. #define L_menu_bar
  23. #define L_menu_ich
  24. #define L_menu_ien
  25. #define L_menu_tno
  26. #define L_menu_tex
  27. #define L_menu_reg
  28. #define L_menu_pop
  29. #define L_menu_att
  30. #define L_menu_ist
  31. #define L_menu_set
  32.  
  33. #endif /* __DEF_ALL__ */
  34.  
  35.  
  36. #ifdef L_menu_bar
  37.  
  38. /* Show/hide a menu bar
  39.  *    returns 0 on error    >0 no error
  40.  */
  41. int menu_bar(void *Tree, int ShowFlag)
  42. {
  43.     _int_in[0] = ShowFlag;
  44.     _addrin[0] = Tree;
  45.  
  46.     return __aes__(AES_CONTROL_ENCODE(30, 1, 1, 1));
  47. }
  48. #endif /* L_menu_bar */
  49.  
  50.  
  51. #ifdef L_menu_ich
  52.  
  53. /* Check/Uncheck a menu item
  54.  *    returns 0 on error    >0 no error
  55.  */
  56. int menu_icheck(void *Tree, int Item, int CheckFlag)
  57. {
  58.     _addrin[0] = Tree;
  59.     _int_in[0] = Item;
  60.     _int_in[1] = CheckFlag;
  61.  
  62.     return __aes__(AES_CONTROL_ENCODE(31, 2, 1, 1));
  63. }
  64. #endif /* L_menu_ich */
  65.  
  66. #ifdef L_menu_ien
  67.  
  68. /* Enable/Disable a menu item
  69.  *    returns 0 on error    >0 no error
  70.  */
  71. int menu_ienable(void *Tree, int Item, int EnableFlag)
  72. {
  73.     _addrin[0] = Tree;
  74.     _int_in[0] = Item;
  75.     _int_in[1] = EnableFlag;
  76.  
  77.     return __aes__(AES_CONTROL_ENCODE(32, 2, 1, 1));
  78. }
  79. #endif /* L_menu_ien */
  80.  
  81. #ifdef L_menu_tno
  82.  
  83. /* Show menu item in Norm/Rev video
  84.  *    returns 0 on error    >0 no error
  85.  */
  86. int menu_tnormal(void *Tree, int Item, int NormalFlag)
  87. {
  88.     _addrin[0] = Tree;
  89.     _int_in[0] = Item;
  90.     _int_in[1] = NormalFlag;
  91.  
  92.     return __aes__(AES_CONTROL_ENCODE(33, 2, 1, 1));
  93. }
  94. #endif /* L_menu_tno */
  95.  
  96. #ifdef L_menu_tex
  97.  
  98. /* Change the text of a menu item
  99.  *    returns 0 on error    >0 no error
  100.  */
  101. int menu_text(void *Tree, int Item, char *Text)
  102. {
  103.     _addrin[0] = Tree;
  104.     _addrin[1] = Text;
  105.     _int_in[0]    = Item;
  106.  
  107.     return __aes__(AES_CONTROL_ENCODE(34, 1, 1, 2));
  108. }
  109. #endif /* L_menu_tex */
  110.  
  111. #ifdef L_menu_reg
  112.  
  113. /* Register an accessory with the Desk Menu
  114.  *    returns menuid    -1 == no more room in desk menu
  115.  */
  116. int menu_register(int ApId, char *MenuText)
  117. {
  118.     _int_in[0] = ApId;
  119.     _addrin[0] = MenuText;
  120.  
  121.     return __aes__(AES_CONTROL_ENCODE(35, 1, 1, 1));
  122. }
  123. #endif /* L_menu_reg */
  124.  
  125. #include <gemfast.h> /* for MENU, OBJECT etc */
  126.  
  127. #ifdef L_menu_pop
  128.  
  129. /* Allows an application to display a popup menu anywhere on the screen.  The
  130.  * popup menu may also have submenus.  If the number of menu items exceed the
  131.  * menu scroll height, the menu may also be set to scroll.    menu_settings can
  132.  * be used to set the height at which all menus will start to scroll.
  133.  *
  134.  * returns 0 on failure, and data in me_data is invalid
  135.  * returns 1 on success, data in me_data is valid
  136.  */
  137. int menu_popup(MENU *me_menu, int me_xpos, int me_ypos, MENU *me_mdata)
  138. {
  139.     _int_in[0]     =    me_xpos;
  140.     _int_in[1]     =    me_ypos;
  141.  
  142.     _addrin[0]    =  me_menu;
  143.     _addrin[1]    =  me_mdata;
  144.  
  145.     return __aes__(AES_CONTROL_ENCODE(36, 2, 1, 2));
  146. }
  147. #endif /* L_menu_pop */
  148.  
  149. #ifdef L_menu_att
  150.  
  151. /* Allows an application to attach, change, remove or inquire about a submenu
  152.  * associated with a menu item.
  153.  *
  154.  * returns:0 failure: the submenu was not attached for whatever reasons
  155.  *           1 success: the submenu was attached, changed or removed successfully
  156.  */
  157. int menu_attach(int me_flag, OBJECT *me_tree, int me_item, MENU *me_mdata)
  158. {
  159.     _int_in[0] = me_flag;
  160.     _int_in[1] = me_item;
  161.  
  162.     _addrin[0] = me_tree;
  163.     _addrin[1] = me_mdata;
  164.     return __aes__(AES_CONTROL_ENCODE(37, 2, 1, 2));
  165. }
  166. #endif /*  L_menu_att */
  167.  
  168. #ifdef L_menu_ist
  169.  
  170. /* Allows an application to set or inquire the starting menu item of a submenu
  171.  * that is associated with a menu item.  The submenu is shifted vertically so
  172.  * that the starting menu item is aligned with the menu item that is associated
  173.  * with this submenu.
  174.  *
  175.  * returns: 0 failure: the submenu is not associated with a menu item.    The
  176.  *                       submenu must be attached via menu_attach before this
  177.  *                       call can be made.
  178.  *           >0 success: the starting menu item is currently set to this value.
  179.  */
  180. int menu_istart(int me_flag, OBJECT *me_tree, int me_imenu, int me_item)
  181. {
  182.     _int_in[0] = me_flag;
  183.     _int_in[1] = me_imenu;
  184.     _int_in[2] = me_item;
  185.  
  186.     _addrin[0] =  me_tree;
  187.  
  188.     return __aes__(AES_CONTROL_ENCODE(38, 3, 1, 1));
  189. }
  190. #endif /* L_menu_ist */
  191.  
  192. #ifdef L_menu_set
  193.  
  194. /* Allows an application to set or inquire the submenu delay values and the
  195.  * menu scroll height value.
  196.  *
  197.  * returns 1 always
  198.  */
  199. int menu_settings(int me_flag, MN_SET *me_values)
  200. {
  201.     _int_in[0] = me_flag;
  202.  
  203.     _addrin[0] = me_values;
  204.     return __aes__(AES_CONTROL_ENCODE(39, 1, 1, 1));
  205. }
  206. #endif /* L_menu_set */
  207.  
  208. /* - eof - */
  209.